package com.songlanyun.modules.exception;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.songlanyun.common.drive.IntegerEnum;

import java.util.Objects;

/**
 * 会员错误异常枚举类
 */
public enum MemberException implements IntegerEnum<Integer> {

    NOT_LOGIN(50000, "请先登录"),
    CODE_NOT_EXIST(50001, "邀请码不存在"),
    PHONE_IS_REGISTER(50002, "手机号已注册"),
    PHONE_NOT_NUll(50003, "手机号不能为空"),
    PASSWORD_NOT_FULL(50004, "密码不能为空"),
    CAPTCHA_NOT_FULL(50005, "验证码不能为空"),
    LOGIN_WRONG(50006, "账号或密码不正确"),
    USER_IS_BINDING(50007, "该用户已绑定过手机，暂不能注册"),
    CHECK_IS_PASS(50008, "该会员已成为商家"),
    PHONE_IS_BINDING(5009, "该手机已绑定过用户，请直接授权登录"),
    USER_ADDRESS_NOT_EXISTS(50010, "会员地址不存在"),
    USER_DEFAULT_ADDRESS_NEED(50011, "默认地址不能删除"),
    USER_ADDRESS_COUNT(50012, "您已有10条收货地址"),
    NOT_EXISTS(50013, "会员不存在"),
    USER_INFO_NOT_EXISTS(50014, "会员信息不存在"),
    OPENID_NOT_EXISTS(50015, "openId不存在"),
    NOT_SUFFICIENT_FUNDS(50016, "会员余额不足"),
    INSUFFICIENT_REDEMPTION_VOUCHERS(52125, "会员兑换券不足"),
    NOT_OPENID(50017, "获取不到OPENID"),
    NOT_STATUS(50018, "锁定状态不能为空"),
    COMMENT_NOT_EXISTS(50019, "评论不存在"),
    USER_EXCEPTION(50020, "会员用户异常"),
    INCOMPLETE_PARAMETER(50021, "参数不完整"),
    USER_DISABLED(50022, "账号已被禁用，请联系平台管理员"),
    USER_BANK_CARD_NOT_EXISTS(50023, "银行卡不存在"),
    USER_INFO_DETECTION_FAIL(50024, "用户信息检测失败"),
    MEMBER_WITHDRAW_INSUFFICIENT_FUND(50025, "会员贡献值不足"),
    MOBILE_NOT_REGISTER(50026, "手机号未注册"),
    CODE_NOT_NULL(50027, "邀请码不能为空"),
    LACK_OF_INTEGRAL(50028, "您的积分不足"),
    UPDATE_GRADE_NOT_ME(50029, "改变的会员不能是自己"),

    CONCERN_EXISTS(50030, "不能重复关注"),
    CONCERN_SELF(50031, "自己不能关注自己"),
    REFERRER_NOT_EXIST(50032, "更改的推荐人不存在"),
    REFERRER_NOT_CHANGE(50033, "更改的推荐人没有改变，无需处理"),
    REFERRER_NOT_DOWN(50034, "更改的推荐人不能为自己的下属会员"),
    REFERRER_DISABLED(50035, "更改的推荐人已被锁定，不能更改"),
    NEW_PHONE_IS_REGISTER(50036, "新手机号已注册"),
    MOBILE_THE_SAME(50037, "旧手机号和新手机号不能相同"),

    COMMENT_SHOW_NOT_EXIST(51001, "评论显示参数不全"),
    NET_RED_APPLY_NOT_EXIST(52002, "网红申请记录不存在"),
    NET_RED_APPLY_USER_ID_NOT_EXIST(52003, "网红申请帐号不存在"),

    NET_RED_APPLY_WAIT(52103, "网红申请记录正在审核中，请勿重复提交申请"),
    NET_RED_APPLY_PASS(52104, "网红申请记录已通过"),
    NET_RED_APPLY_CHECK_AGAIN(52105, "请勿多次审核"),

    PRIVATE_MESSAGE_NOT_EXIST(52106, "消息不存在"),
    RESUME_NOT_EXIST(52107, "个人简介不能为空"),

    STORES_CAN_ONLY_MODIFY_MEMBERSHIP_LEVELS(52108, "店铺才能修改会员等级"),
    AGE_LEVELS_CANNOT_BE_MODIFIED(52109, "不能修改市代的等级"),
    THE_LEVEL_CONFIGURATION_DOES_NOT_EXIST(52110, "等级配置不存在"),
    ABNORMAL_GRADE_PARAMETER(52111, "等级参数异常"),
    THE_CORRESPONDING_AREA_HAS_ALREADY_BEEN_SELECTED(52112, "对应的区域已经被选择，不能再选择"),
    YOU_CAN_ONLY_BUY_A_HIGHER_LEVEL_PACKAGE(52113, "只能买本身级别更高的礼包"),
    MEMBER_SERVICE_AREA_RELATIONSHIP_DOES_NOT_EXIST(52114, "会员服务地区关系不存在"),
    YOU_ARE_ALREADY_A_REGIONAL_COMPANY(52115, "您已经是大区公司身份，不能再购买"),
    ONLY_REGIONAL_COMPANIES_CAN_CHOOSE_MORE_THAN_ONE_PROVINCE(52116, "只有大区公司才能选择多个省份"),
    YOUR_LOVE_VALUE_IS_INSUFFICIENT(52117, "你的爱心值不足"),
    TOO_LITTLE_LOVE_IN_EXCHANGE(52118, "兑换的爱心值太少，无需进行操作"),
    TOO_FEW_POINTS_AFTER_HEART_VALUE_EXCHANGE(52119, "爱心值兑换后的积分太少"),

    YOU_ARE_NOT_BOUND_TO_WECHAT(52120, "你未绑定微信"),
    YOU_ARE_NOT_BOUND_TO_ALIPAY(52121, "你未绑定支付宝"),

    CODE_EXIST(52122, "邀请码已存在"),
    ONLY_MEMBERS_OF_THE_SERVICE_SYSTEM_CAN_USE_BANK_CARDS_TO_WITHDRAW_CASH(52123, "只有服务体系成员用户才可使用银行卡提现"),


    ACCOUNT_NUMBER_NOT_UNION_BUSINESS(52124, "账号不是联盟商家，请联系平台管理员"),

    ;


    private Integer code;

    private String msg;

    MemberException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    @Override
    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    @JsonCreator
    public static MemberException getByCode(int code) {
        for (MemberException value : MemberException.values()) {
            if (Objects.equals(code, value.getCode())) {
                return value;
            }
        }
        return null;
    }
}
